import request from '@/utils/request.js'

// 获取用户频道列表数据的 API
export const getUserChannelsAPI = function () {
  return request.get('/v1_0/user/channels')
}

// 根据频道 id和时间戳请求文章列表数据的API
export const getArtListAPI = function (id, time) {
  return request.get('/v1_0/articles', {
    // params 指向的才是GET的参数对象
    params: {
      // 频道的id
      channel_id: id,
      timestamp: time
    }
  })
}

// 将文章设置为不感兴趣
export const dislikeArticleAPI = function (id) {
  return request.post('/v1_0/article/dislikes', { target: id })
}

// 举报文章的API
// target id , type 类型
export const reportArticleAPI = function (target, type) {
  return request.post('/v1_0/article/reports', { target, type })
}

// 获取所有的频道列表数据
export const getAllChennelAPI = function () {
  return request.get('/v1_0/channels')
}

// 更新用户的频道列表数据
export const updateUserChannelAPI = function (channels) {
  return request.put('/v1_0/user/channels', { channels })
}
